﻿using System.ComponentModel.Composition;
using System.Windows;
using ScrumFactory.Composition.ViewModel;

namespace ScrumFactory.ProjectsList {


    /// <summary>
    /// Create Project view.
    /// </summary>
    public partial class CreateProject : Window, ICreateProjectView {

        ICreateProjectViewModel model;

        /// <summary>
        /// Initializes a new instance of the <see cref="CreateProject"/> class.
        /// </summary>
        [ImportingConstructor()]
        public CreateProject() {            
            this.InitializeComponent();            
        }        

        #region ICreateProjectView Members

        /// <summary>
        /// Hides the Window.Show() method, and instead opens a Dialog window.
        /// </summary>
        /// <exception cref="T:System.InvalidOperationException">
        /// 	<see cref="M:System.Windows.Window.Show"/> is called on a window that is closing (<see cref="E:System.Windows.Window.Closing"/>) or has been closed (<see cref="E:System.Windows.Window.Closed"/>).</exception>
        void ICreateProjectView.Show() {
            Owner = Application.Current.MainWindow;
            ShowDialog();
        }

        /// <summary>
        /// Gets or sets the model.
        /// </summary>
        /// <value>The model.</value>
        public ICreateProjectViewModel Model {
            get {
                return this.model;
            }
            set {
                this.model = value;
                this.DataContext = value;
            }
        }

        #endregion
    }
}
